﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAL.Connect;
using DAL.Classes;

public partial class UserControl_UCBinhLuan : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            PopulateControls();
        }
    }
    private void PopulateControls()
    {
        string page = Request.QueryString["Trang"] ?? "1";
        string maBaiDang = Request.QueryString["BaiDangID"];
        int howManyPages = 0;
        string firstPageUrl = "";
        string pagerFormat = "";
        if (maBaiDang != "")
        {
            repComment.DataSource = BinhLuan.LayBinhLuanTheoBaiDang(maBaiDang, page, out howManyPages);
            repComment.DataBind();
            firstPageUrl = Link.DenBinhLuan(maBaiDang);
            pagerFormat = Link.DenBinhLuan(maBaiDang, "{0}");
        }
        PagerBottom.Show(int.Parse(page), howManyPages, firstPageUrl, pagerFormat, true);
    }
}
